// alert("user-query");

$(function () {
    // alert("不执行吗");
    $('#uq-table').datagrid({
        url: uri + 'user/getUserByQueryParams',                        //获取远程数据
        // method:'post',
        loadMsg: '数据加载中...',
        fit: true,                                        //面板大小自适应父容器
        fitColumns: true,                                //表格自适应面板
        striped: true,                                    //是否显示斑马效果
        rownumbers: true,                                //显示行号
        border: false,                                    //是否显示边框
        singleSelect:true,
        width: '100%',
        pagination: true,                                //是否显示分页
        pageSize: 20,                                    //每页显示多少条数据
        pageList: [5, 10, 15, 20, 25, 50, 100],                //可选每页显示多少条数据
        pageNumber: 1,                                    //起始页
        sortName: 'createTime',                                //默认以什么字段排序
        sortOrder: 'desc',                                //排序方式
        toolbar: '#uq-search',                        //加载增删改查工具栏区块
        headers: {
            token: !isNull(userToken) ? userToken : localStorage.getItem("userToken"),
            'Content-Type': 'application/json;charset=utf-8',
        },
        columns: [[
            {field: 'id', title: 'id', width: 100},
            {field: 'name', title: '姓名', width: 100},
            {field: 'username', title: '用户名', width: 100},
            {field: 'birthday', title: '出生日期', width: 100},
            {field: 'idNo', title: '证件号', width: 100},
            {field: 'mobile', title: '手机号', width: 100},
            {field: 'email', title: '邮箱', width: 100},
            {field: 'createTime', title: '创建时间', width: 100,formatter:function (value) {
                    return dateFormat(value, 'datetime');
                }},

            /*{field:'',title:'操作',width:100,align:'right'}*/
        ]],
        /*loader:function(param,success,error) {
            var opts = $(this).datagrid("options");
            if (!opts.url){
                return false;
            }
            $.ajax({
                type:opts.method,
                url:opts.url,
                dataType:'json',
                contentType:'application/json;charset=utf-8',
                data:JSON.stringify(param),
                success:function(data){
                    success(data);
                }
            })
        }*/

        /*loader:function (param,success,error)  {
            $.ajax({
                type:'post',
                url: uri + 'user/getAllUser',
                dataType:'json',
                contentType:'application/json',
                data:JSON.stringify(param),
                success:function (data){
                    console.log(JSON.stringify(data));
                    success(data);
                }
            })
        }*/
    })
    /* alert("ddd");

     $('#uq-table').datagrid({
         title: '用户数据',
         iconCls: 'icon-edit',//图标
         url: 'user/getUserByQueryParams',
         method:'post',
         height: 'auto',
         // 显示行
         nowrap: true,
         striped: true,
         border: true,
         collapsible: false,//是否可折叠的
         fit: true,//自动大小

         //sortName: 'code',
         //sortOrder: 'desc',
         remoteSort: false,
         idField: 'id',
         singleSelect: false,//是否单选
         pagination: true,//分页控件
         rownumbers: true,//行号
         frozenColumns: [[
             {field: 'ck', checkbox: true}
         ]],
         toolbar: '#uq-search',
         /!*toolbar: [{
             text: '添加',
             iconCls: 'icon-add',
             handler: function() {
                 openDialog("add_dialog","add");
             }
         }, '-', {
             text: '修改',
             iconCls: 'icon-edit',
             handler: function() {
                 openDialog("add_dialog","edit");
             }
         }, '-',{
             text: '删除',
             iconCls: 'icon-remove',
             handler: function(){
                 delAppInfo();
             }
         }],*!/


     });*/
});